<template>
	<div class="buycart">

		<div class="buyhead">
			<div class="poshead">
				<div class="btn">
					<div class="back-btn" @click="gotoBack"></div>
				</div>
				<span>购物车</span>
				<div class="editOn" v-show="isHide">
					<span v-show="!isShow" @click="editOne">编辑</span>
					<span v-show="isShow" @click="editTwo">完成</span>
				</div>
			</div>
		</div>
		<productList :is-show="isShow"/>
		<div class="emptycart" v-show="!isHide">
			<div class="empImg">
				<img src="http://m.wangjiu.com/htmlResource/images/c03.png"/>
				<p>
					您的购物车还是空的哦
				</p>
			</div>
			<router-link to="/" tag="div" class="gotoIndex">
				<p>
					去逛逛
				</p>
			</router-link>
		</div>
	</div>

</template>

<script>
	import Vue from 'vue'
	import VueResource from 'vue-resource'
	import store from '../vuex/store'
	
	import ProductiList from '../components/ProductList.vue'
	
	export default {
		data() {
			return {
				count: 1,
				isShow:true,
				isActive:true
			}
		},
		computed: {
			isHide() {
				this.isShow = false;
				return this.$store.state.shopcar.data.length != 0
				
			}
		},
		components:{
			productList:ProductiList
		},
		methods: {
			
			editOne(){
//				this.$store.commit('editOn','true')
				this.isShow = true
			},
			editTwo(){
//				this.$store.commit('editOn','false')
				this.isShow = false
				
			},
			gotoBack() {
				this.$router.go(-1)
				
			}
			
			
		},
		mounted() {
			
		},
		store
	}
</script>
